﻿
(function ($) {
    $.fn.reportsubmit = function (option) {
        option = $.extend({
            application: null
            //text: null,
            //closeable: false,
            //href:null,
            //postdata: {}
        }, option);
        return this.each(function () {
            var view = $(this);
            var parent = view.PanelParent();
            var form = view.closest("form");
            var url = form.attr("action");
            view.click(function () {
                var obj = {};
                var queryobj = form.serializeArray();
                if (queryobj) {
                    for (var i = 0; i < queryobj.length; i++) {
                        obj[queryobj[i].name] = queryobj[i].value;
                    }
                }
                var settings = $.extend({
                    title: "请稍等",
                    url: url,
                    data: obj,
                    type: "html",
                    backtype: "fill",
                    mask: view.attr("mask"),
                    successmsg: null,
                    tabid: view.PanelParent().helper("remotePanel").getId()
                }, option);

                settings.application.getAjaxManager().ajaxpost(settings);
            });
        });
    }
})(jQuery);